package movie;

import java.util.HashMap;
import java.util.Map;
/*
*
*public void addMovie(String title)
* public void addRating(String movieTitle, int rating)
* public void addReview(String movieTitle, String review)
* public void printMovieDetails(String movieTitle)
 *
*
*
* */
public class MovieSystem {
    private Map<String, Movie> movies;

    public MovieSystem() {
        this.movies = new HashMap<>();
    }

    public void addMovie(String title){
        movies.put(title, new Movie(title));
    }


    public void addRating(String movieTitle, int rating){
        Movie movie = movies.get(movieTitle);
        if(movie!=null){
            movie.addRating(rating);
        }else {
            System.out.println("未找到电影:" + movieTitle);
        }
    }

    public void addReview(String movieTitle, String review){
        Movie movie = movies.get(movieTitle);
        if (movie != null) {
            movie.addRaviews(review);
        }else {
            System.out.println("未找到电影:" + movieTitle);
        }
    }

    public void printMovieDetails(String movieTitle){
        Movie movie = movies.get(movieTitle);
        if (movie!=null) {
            movie.printDetails();
        }else {
            System.out.println("未找到电影:" + movieTitle);
        }
    }
}
